import 'package:flutter/material.dart';
import 'package:wheel_of_fortune/utils/utils.dart';

class AddressList extends StatelessWidget {
  final List<Widget> iteams;
  final dataList;
  const AddressList(this.dataList, this.iteams, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        height: iteams.length > 7 ? 30.0 * 7 : 30.0 * iteams.length,
        margin: EdgeInsets.only(top: 3, bottom: 3),
        alignment: Alignment.center,
        color: whiteColor,
        child: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: List.generate(this.iteams.length, (index) {
              return GestureDetector(
                child: this.iteams[index],
                onTap: () {
                  final data = this.dataList[index];
                  Navigator.of(context).pop(data);
                },
              );
            }),
          ),
        ),
      ),
    );
  }
}
